﻿using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.EventSystems;
using UnityEngine.UI;

namespace Jinndev {

    public class BaseUIBehaviour : BaseBehaviour {

        #region UI
        public void ForceLayout(string path) {
            UIUtil.ForceLayout(transform, path);
        }

        public void ForceLayout(Object parent, string path) {
            UIUtil.ForceLayout(parent, path);
        }

        public void SetImage(string path, Sprite sprite) {
            UIUtil.SetImage(transform, path, sprite);
        }

        public void SetImage(Object parent, string path, Sprite sprite) {
            UIUtil.SetImage(parent, path, sprite);
        }

        public void SetRawImage(string path, Texture2D texture) {
            UIUtil.SetRawImage(transform, path, texture);
        }

        public void SetRawImage(Object parent, string path, Texture2D texture) {
            UIUtil.SetRawImage(parent, path, texture);
        }

        public void SetText(string path, string text) {
            UIUtil.SetText(transform, path, text);
        }

        public void SetText(Object parent, string path, string text) {
            UIUtil.SetText(parent, path, text);
        }

        public void SetTextColor(string path, Color color) {
            UIUtil.SetTextColor(transform, path, color);
        }

        public void SetTextColor(Object parent, string path, Color color) {
            UIUtil.SetTextColor(parent, path, color);
        }

        public void SetTextAndColor(string path, string text, Color color) {
            UIUtil.SetTextAndColor(transform, path, text, color);
        }

        public void SetTextAndColor(Object parent, string path, string text, Color color) {
            UIUtil.SetTextAndColor(parent, path, text, color);
        }

        public void SetInputText(string path, object text) {
            UIUtil.SetInputText(transform, path, text);
        }

        public void SetInputText(Object parent, string path, object text) {
            UIUtil.SetInputText(parent, path, text);
        }

        public string GetInputText(string path, string defaultValue = null) {
            return UIUtil.GetInputText(transform, path, defaultValue);
        }

        public string GetInputText(Object parent, string path, string defaultValue = null) {
            return UIUtil.GetInputText(parent, path, defaultValue);
        }

        public void AddInputChange(string path, UnityAction<string> action) {
            UIUtil.AddInputChange(transform, path, action);
        }

        public void AddInputChange(Object parent, string path, UnityAction<string> action) {
            UIUtil.AddInputChange(parent, path, action);
        }

        public void SetDropdownOptions(string path, List<Dropdown.OptionData> options) {
            UIUtil.SetDropdownOptions(transform, path, options);
        }

        public void SetDropdownOptions(Object parent, string path, List<Dropdown.OptionData> options) {
            UIUtil.SetDropdownOptions(parent, path, options);
        }

        public void SetDropdownValue(string path, int value) {
            UIUtil.SetDropdownValue(transform, path, value);
        }

        public void SetDropdownValue(Object parent, string path, int value) {
            UIUtil.SetDropdownValue(parent, path, value);
        }

        public int GetDropdownValue(string path) {
            return UIUtil.GetDropdownValue(transform, path);
        }

        public int GetDropdownValue(Object parent, string path) {
            return UIUtil.GetDropdownValue(parent, path);
        }

        public void AddButtonClick(string path, UnityAction action, bool removeBeforeAdd = true) {
            UIUtil.AddButtonClick(transform, path, action, removeBeforeAdd);
        }

        public void AddButtonClick(Object parent, string path, UnityAction action, bool removeBeforeAdd = true) {
            UIUtil.AddButtonClick(parent, path, action, removeBeforeAdd);
        }

        public void AddMouseClick(string path, PointerEventData.InputButton button, UnityAction<Vector2> action) {
            UIUtil.AddMouseClick(transform, path, button, action);
        }

        public void AddMouseClick(Object parent, string path, PointerEventData.InputButton button, UnityAction<Vector2> action) {
            UIUtil.AddMouseClick(parent, path, button, action);
        }

        public void AddMouseClick(string path, PointerEventData.InputButton button, UnityAction action) {
            UIUtil.AddMouseClick(transform, path, button, (position) => { action?.Invoke(); });
        }

        public void AddMouseClick(Object parent, string path, PointerEventData.InputButton button, UnityAction action) {
            UIUtil.AddMouseClick(parent, path, button, (position) => { action?.Invoke(); });
        }

        public void AddToggleChange(string path, UnityAction<bool> action, bool removeBeforeAdd = true) {
            UIUtil.AddToggleChange(transform, path, action, removeBeforeAdd);
        }

        public void AddToggleChange(Object parent, string path, UnityAction<bool> action, bool removeBeforeAdd = true) {
            UIUtil.AddToggleChange(parent, path, action, removeBeforeAdd);
        }

        public void SetToggleValue(string path, bool isOn) {
            UIUtil.SetToggleValue(transform, path, isOn);
        }

        public void SetToggleValue(Object parent, string path, bool isOn) {
            UIUtil.SetToggleValue(parent, path, isOn);
        }

        public bool GetToggleValue(string path) {
            return UIUtil.GetToggleValue(transform, path);
        }

        public bool GetToggleValue(Object parent, string path) {
            return UIUtil.GetToggleValue(parent, path);
        }

        public void SetButtonInteractive(string path, bool interactable) {
            UIUtil.SetButtonInteractable(transform, path, interactable);
        }

        public void SetButtonInteractive(Object parent, string path, bool interactable) {
            UIUtil.SetButtonInteractable(parent, path, interactable);
        }
        #endregion

    }

}
